﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using Wildweeds.SSO.SecondWebSite.SSOAuth;

namespace Wildweeds.SSO.SecondWebSite
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                UserInfo userInfo = Session["user"] as UserInfo;
                if (userInfo != null)
                    lit_user.Text = string.Format("用户已登录。用户名：{0}，注册时间：{1}", userInfo.UserName, userInfo.CreateDate);
                else
                    lit_user.Text = "用户未登录";
            }
        }

        protected void SignOut(object sender, EventArgs e)
        {
            Session["user"] = null;
            string SSOUrl = ConfigurationManager.AppSettings["SSOUrl"];
            Response.Redirect(SSOUrl + "SignOut.aspx?ReturnUrl=" + Context.Request.Url.AbsoluteUri);
        }
    }
}